<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>整合 NKeditor 编辑器</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta http-equiv="Access-Control-Allow-Origin" content="*">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">
    <link rel="icon" href="favicon.ico">
    <link rel="stylesheet" href="../../assets/css/main.css">
</head>
<body>

<div class="x-body">

    <blockquote class="layui-elem-quote">
        本页面所有 demo 均采用的 NKeditor 编辑器，想了解更多有关 NKeditor 信息，请点击
        <a href="https://gitee.com/blackfox/kindeditor" target="_blank" class="text-color-red text-bold">这里</a> 查看。
    </blockquote>

    <div class="layui-col-sm12" style="margin-bottom: 15px;">
        <fieldset class="layui-elem-field layui-field-title">
            <legend>自定义组件</legend>
        </fieldset>

        <textarea name="content1" style="width:900px;height:200px;visibility:hidden;">春花秋月何时了，往事知多少，小楼昨夜又东风，故国不堪回首月明中。</textarea>
    </div>

    <div class="layui-col-sm12" style="margin-bottom: 15px;">
        <fieldset class="layui-elem-field layui-field-title">
            <legend>全功能版</legend>
        </fieldset>

        <textarea name="content2" style="width:900px;height:200px;visibility:hidden;">春花秋月何时了，往事知多少，小楼昨夜又东风，故国不堪回首月明中。</textarea>
    </div>


    <div class="layui-col-sm12" style="margin-bottom: 15px;">
        <fieldset class="layui-elem-field layui-field-title">
            <legend>Skin Grey</legend>
        </fieldset>

        <textarea name="content3" style="width:900px;height:200px;visibility:hidden;">春花秋月何时了，往事知多少，小楼昨夜又东风，故国不堪回首月明中。</textarea>
    </div>


    <div class="layui-col-sm12" style="margin-bottom: 15px;">
        <fieldset class="layui-elem-field layui-field-title">
            <legend>Skin Blue</legend>
        </fieldset>

        <textarea name="content4" style="width:900px;height:200px;visibility:hidden;">春花秋月何时了，往事知多少，小楼昨夜又东风，故国不堪回首月明中。</textarea>
    </div>

</div>

<script type="text/javascript" src="../../js/libs/jquery.min.js "></script>
<script type="text/javascript" src="../../js/libs/layui/layui.js"></script>
<script type="text/javascript" src="../../js/libs/NKeditor/NKeditor-all-min.js"></script>
<script>
	layui.use(['layer'], function(){

		KindEditor.ready(function(K) {
			K.create('textarea[name="content1"]', {
				uploadJson : "http://herosphp.r9it.com/admin/upload/qiniu",
				fileManagerJson : 'http://herosphp.r9it.com/admin/upload/filelist',
				imageSearchJson : null, //图片搜索url
				dialogOffset : 0, //对话框距离页面顶部的位置，默认为0居中，
				filePostName: 'file',
				items : ['formatblock', 'fontname', 'fontsize','forecolor','justifyleft', 'justifycenter', 'justifyright',
					'justifyfull', 'insertorderedlist', 'insertunorderedlist', 'indent', 'outdent', 'bold', 'italic', 'underline',
					'lineheight', 'removeformat','code', 'plainpaste','image', 'table', 'hr', 'pagebreak','link', 'unlink',
					'preview','about'
				],
				allowFileManager : true,
				allowImageUpload : true,
				afterCreate : function() {
					var self = this;
					K.ctrl(document, 13, function() {
						self.sync();
						K('form[name=example]')[0].submit();
					});
					K.ctrl(self.edit.doc, 13, function() {
						self.sync();
						K('form[name=example]')[0].submit();
					});
				},
				//错误处理 handler
				errorMsgHandler : function(message, type) {
					layer.alert(message);
				}
			});

			K.create('textarea[name="content2"]', {
				uploadJson : "http://herosphp.r9it.com/admin/upload/qiniu",
				fileManagerJson : 'http://herosphp.r9it.com/admin/upload/filelist',
				imageSearchJson : null, //图片搜索url
				dialogOffset : 0, //对话框距离页面顶部的位置，默认为0居中，
				filePostName: 'file',
				allowFileManager : true,
				allowImageUpload : true,
				allowMediaUpload : true,
				themeType : "black", //主题
				//错误处理 handler
				errorMsgHandler : function(message, type) {
					layer.alert(message);
				}
			});

			K.create('textarea[name="content3"]', {
				uploadJson : "http://herosphp.r9it.com/admin/upload/qiniu",
				fileManagerJson : 'http://herosphp.r9it.com/admin/upload/filelist',
				imageSearchJson : null, //图片搜索url
				dialogOffset : 0, //对话框距离页面顶部的位置，默认为0居中，
				filePostName: 'file',
				allowFileManager : true,
				allowImageUpload : true,
				allowMediaUpload : true,
				themeType : "grey", //主题
				//错误处理 handler
				errorMsgHandler : function(message, type) {
					layer.alert(message);
				}
			});

			K.create('textarea[name="content4"]', {

				uploadJson : "http://herosphp.r9it.com/admin/upload/qiniu",
				fileManagerJson : 'http://herosphp.r9it.com/admin/upload/filelist',
				imageSearchJson : null, //图片搜索url
				dialogOffset : 0, //对话框距离页面顶部的位置，默认为0居中，
				filePostName: 'file',
				allowFileManager : true,
				allowImageUpload : true,
				allowMediaUpload : true,
				themeType : "blue", //主题
				//错误处理 handler
				errorMsgHandler : function(message, type) {
					layer.alert(message);
				}
			});
		});

	});

</script>
</body>
</html>